"""
@ Author       : Zhangyang shouhu159@126.com
@ LastEditTime : 2024-12-07 00:40
@ FilePath     : /mmrotate/mmrotate/core/hooks/get_image_hook.py
@ 
@ coded by ZhangYang@BUPT, my email is zhangynag0706@bupt.edu.cn
"""
from mmcv.runner.hooks import HOOKS
from mmcv.runner.hooks import Hook
from mmengine import MessageHub



@HOOKS.register_module()
class GetImageHook(Hook):
    def __init__(self, interval: int = 1):
        self.interval = interval
        
    def before_iter(self, runner):
        # print('before_iter')
        message_hub = MessageHub.get_current_instance()
        message_hub.update_info('image', runner.data_batch['img_metas'])
        message_hub.update_info('gt_bboxes', runner.data_batch['gt_bboxes'])

